#ifndef __MISC_H__
#define __MISC_H__
#include <string>
using namespace std;

enum modifiers_e {
     nl=0x1,
     fl,
     empty,
     critical,
     error,
     warning,
     info,
     debug
     };
     
class errorlog_t {
  public:
    std::string fName;
    int mode;
    errorlog_t();
    inline int getms();
    errorlog_t(const char*);
    ~errorlog_t();

     errorlog_t& operator << (const char var);
     errorlog_t& operator << (const char* var);
     errorlog_t& operator << (const string var);     
     errorlog_t& operator << (const bool var);
     errorlog_t& operator << (const short var);
     errorlog_t& operator << (const unsigned short var);
     errorlog_t& operator << (const int var);
     errorlog_t& operator << (const unsigned int var);
	   errorlog_t& operator << (const long var);
	   errorlog_t& operator << (const unsigned long var);
	   errorlog_t& operator << (const float var);
	   errorlog_t& operator << (const double var);
	   errorlog_t& operator << (const long double var);
	   errorlog_t& operator << (const void* var);
   	 errorlog_t& operator << (modifiers_e which);	   	   

  private:
	  ofstream * file;
  	float treshold;
  	char* opbuffer;
  	int opbuffer_level;
  	void log();
  	void operator_buffer(const char *);

};

extern errorlog_t *lg;
#endif
